package kafeisc.utils;
/**
 * @Classname MailUtils
 * @Description TODO
 * @Date 21:08
 * @Created 
 */


import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;


/**
 * 发送邮件的工具类
 */
public class MailUtils {
   public static void sendMail(String email, String emailMsg)
           throws  EmailException {

      // 创建一个HtmlEmail 实例对象
      HtmlEmail send = new HtmlEmail();
      send.setHostName("smtp.qq.com");
      send.setAuthentication("321395678@qq.com","vrbnfdf66666ravxkbgid");
      send.setFrom("321395678@qq.com","咖啡书城");
      send.setSSLOnConnect(true);
      send.setCharset("utf-8");
      send.addTo(email);
      send.setSubject("用户激活");
      send.setHtmlMsg(emailMsg);
      send.send();
   }
}
